<?php
declare (strict_types=1);

namespace app\backend\validate;

use think\Validate;

class RolePermissionValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'role_id' => 'require',
        'permission_id' => 'require',

    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'id不能为空',
        'role_id.require' => '请选择角色',
        'permission_id.require' => '请选择节点',

    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'save' => ['role_id','permission_id'],
        'update' => ['id', 'role_id','permission_id']
    ];
}
